package blms.facade;

import java.io.File;
import java.io.Serializable;
import java.text.ParseException;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.TreeSet;

import blms.domain.League;
import blms.domain.Match;
import blms.domain.User;
import blms.exception.LeagueDoesNotExistException;
import blms.exception.MatchDoesNotExistException;
import blms.exception.RestrictionException;
import blms.exception.UnknownAttributeException;
import blms.exception.UserDoesNotExistException;
import blms.exception.ValidationException;
import blms.services.LeagueService;
import blms.services.MatchService;
import blms.services.UserService;

/**
 * 
 * This class provides the services of the BLMS system. It is used by the
 * easyaccept in order to execute testcases for the system.
 * 
 * @author João Arthur
 * @author Jonhnny Weslley
 * @author Thiago Emmanuel
 * 
 */
public class BLMSFacade {

	private final BLMS blms = new BLMS();

	/**
	 * Sets the database used.
	 * 
	 * @param dataBaseName
	 *            teh database name.
	 */
	public void useDatabase(final String dataBaseName) {
		// not required yet
	}

	/**
	 * EasyAccept facade for {@link LeagueService#removeAllLeagues()} method.
	 */
	public void removeAllLeagues() {
		blms.getLeagueService().removeAllLeagues();
	}

	/**
	 * EasyAccept facade for {@link MatchService#removeAllMatches()} method.
	 */
	public void removeAllMatches() {
		blms.getMatchService().removeAllMatches();
	}

	/**
	 * EasyAccept facade for {@link UserService#removeAllUsers()} method.
	 */
	public void removeAllUsers() {
		blms.getUserService().removeAllUsers();
	}

	/**
	 * EasyAccept facade for {@link UserService#findUserByLastName(String)} method.
	 * 
	 * @param lastName
	 * @return
	 * @throws UserDoesNotExistException
	 */
	public List<String> findUserByLastName(final String lastName)
			throws UserDoesNotExistException {
		return blms.getUserService().findUserByLastName(lastName);
	}

	/**
	 * EasyAccept facade for {@link UserService#createUser(String, String, String, String, String, String, File)} method.
	 * 
	 * @param firstName
	 * @param lastName
	 * @param homePhone
	 * @param workPhone
	 * @param cellPhone
	 * @param email
	 * @param picture
	 * @return
	 * @throws ValidationException
	 * @throws RestrictionException 
	 */
	public Serializable createUser(final String firstName,
			final String lastName, final String homePhone,
			final String workPhone, final String cellPhone, final String email,
			final File picture) throws ValidationException, RestrictionException{
		return blms.getUserService().createUser(firstName, lastName, homePhone,
				workPhone, cellPhone, email, picture).getId();
	}

	/**
	 * EasyAccept facade for {@link BLMS#getUserAttribute(String, String)} method.
	 * 
	 * @param id
	 * @param attribute
	 * @return
	 * @throws UserDoesNotExistException
	 * @throws UnknownAttributeException
	 */
	public Object getUserAttribute(final String id, final String attribute) throws UserDoesNotExistException, UnknownAttributeException{
		return blms.getUserAttribute(id, attribute);
	}

	/**
	 * EasyAccept facade for {@link BLMS#changeUserAttribute(String, String, String)} method.
	 * 
	 * @param id
	 * @param attribute
	 * @param value
	 * @throws ValidationException
	 * @throws UserDoesNotExistException
	 * @throws UnknownAttributeException
	 * @throws RestrictionException
	 */
	public void changeUserAttribute(final String id, final String attribute,
			final String value) throws ValidationException, UserDoesNotExistException, UnknownAttributeException, RestrictionException{
		blms.changeUserAttribute(id, attribute, value);
	}

	/**
	 * EasyAccept facade for {@link UserService#deleteUser(Serializable)} method.
	 * 
	 * @param id
	 * @throws ValidationException
	 * @throws UserDoesNotExistException
	 * @throws RestrictionException 
	 */
	public void deleteUser(final String id) throws ValidationException, UserDoesNotExistException, RestrictionException{
		blms.getUserService().deleteUser(id);
	}

	/**
	 * EasyAccept facade for {@link LeagueService#findLeagueByName(String)} method.
	 * 
	 * @param name
	 * @return
	 * @throws LeagueDoesNotExistException
	 */
	public List<String> findLeague(final String name)
			throws LeagueDoesNotExistException {
		return blms.getLeagueService().findLeagueByName(name);
	}

	/**
	 * EasyAccept facade for {@link LeagueService#createLeague(String, String)} method.
	 * 
	 * @param name
	 * @param operator
	 * @return
	 * @throws ValidationException 
	 * @throws UserDoesNotExistException 
	 * @throws RestrictionException 
	 */
	public Serializable createLeague(final String name, final String operator) throws UserDoesNotExistException, ValidationException, RestrictionException{
		return blms.getLeagueService().createLeague(name, operator, new Date()).getId();
	}

	/**
	 * EasyAccept facade for {@link BLMS#getLeagueAttribute(Serializable, String)} method.
	 * 
	 * @param id
	 * @param attribute
	 * @return
	 * @throws LeagueDoesNotExistException
	 * @throws UnknownAttributeException
	 */
	public Object getLeagueAttribute(final String id, final String attribute) throws LeagueDoesNotExistException, UnknownAttributeException{
		return blms.getLeagueAttribute(id, attribute);
	}

	/**
	 * EasyAccept facade for {@link BLMS#changeLeagueAttribute(String, String, String)} method.
	 * 
	 * @param id
	 * @param attribute
	 * @param value
	 * @throws ValidationException
	 * @throws LeagueDoesNotExistException
	 * @throws UnknownAttributeException
	 * @throws RestrictionException 
	 * @throws UserDoesNotExistException 
	 */
	public void changeLeagueAttribute(final String id, final String attribute,
			final String value) throws ValidationException, LeagueDoesNotExistException, UnknownAttributeException, UserDoesNotExistException, RestrictionException{
		blms.changeLeagueAttribute(id, attribute, value);
	}

	/**
	 * EasyAccept facade for {@link LeagueService#deleteLeague(Serializable)} method.
	 * 
	 * @param id
	 * @throws LeagueDoesNotExistException
	 */
	public void deleteLeague(final String id)
			throws LeagueDoesNotExistException {
		blms.getLeagueService().deleteLeague(id);
	}

	/**
	 * EasyAccept facade for {@link BLMS#isLeagueMember(String, Serializable)} method.
	 * 
	 * @param userID
	 * @param leagueID
	 * @return
	 * @throws LeagueDoesNotExistException
	 * @throws UserDoesNotExistException
	 */
	public boolean isLeagueMember(final String userID, final String leagueID) throws LeagueDoesNotExistException, UserDoesNotExistException{
		return blms.isLeagueMember(userID, leagueID);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getPlayerLeagues(String)} method.
	 * 
	 * @param id
	 * @return
	 * @throws UserDoesNotExistException
	 */
	public String getPlayerLeagues(final String id)
			throws UserDoesNotExistException {
		final Iterable<League> leagues = blms.getPlayerLeagues(id);
		return toString(leagues);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getLeagueMembers(Serializable)} method.
	 * 
	 * @param idLeague
	 * @return
	 * @throws LeagueDoesNotExistException
	 */
	public String getLeagueMembers(final String idLeague)
			throws LeagueDoesNotExistException {
		final Collection<String> returnValue = new TreeSet<String>();
		final Iterable<User> leagueMembers = blms.getLeagueMembers(idLeague);
		for (final User user : leagueMembers) {
			returnValue.add(user.getLastName());
		}
		return toString(returnValue);
	}

	/**
	 * EasyAccept facade for {@link BLMS#joinLeague(String, Serializable, String)} method.
	 * 
	 * @param userID
	 * @param leagueId
	 * @param initialHandicap
	 * @throws UserDoesNotExistException
	 * @throws LeagueDoesNotExistException
	 * @throws ValidationException 
	 * @throws RestrictionException 
	 * @throws NumberFormatException 
	 */
	public void joinLeague(final String userID, final String leagueId,
			final String initialHandicap) throws UserDoesNotExistException, LeagueDoesNotExistException, NumberFormatException, RestrictionException, ValidationException{
		blms.joinLeague(userID, leagueId, initialHandicap);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getLeagueAttribute(Serializable, String)} method.
	 * 
	 * @param userID
	 * @param leagueId
	 * @param attribute
	 * @return
	 * @throws UserDoesNotExistException
	 * @throws LeagueDoesNotExistException
	 * @throws UnknownAttributeException
	 * @throws RestrictionException 
	 */
	public Object getUserLeagueAttribute(final String userID,
			final String leagueId, final String attribute) throws UserDoesNotExistException, LeagueDoesNotExistException, UnknownAttributeException, RestrictionException{
		return blms.getUserLeagueAttribute(userID, leagueId, attribute);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getLeagueAttribute(Serializable, String)} method.
	 * 
	 * @param userID
	 * @param leagueId
	 * @throws LeagueDoesNotExistException
	 * @throws UserDoesNotExistException
	 * @throws ValidationException 
	 * @throws RestrictionException 
	 */
	public void leaveLeague(final String userID, final String leagueId) throws LeagueDoesNotExistException, UserDoesNotExistException, ValidationException, RestrictionException{
		blms.leaveLeague(userID, leagueId);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getNumberOfMatches(Serializable)} method.
	 * 
	 * @param leagueID
	 * @return
	 * @throws LeagueDoesNotExistException
	 */
	public int getNumberOfMatches(final String leagueID)
			throws LeagueDoesNotExistException {
		return blms.getNumberOfMatches(leagueID);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getNumberOfMatches(Serializable, Serializable)} method.
	 * 
	 * @param playerID
	 * @param leagueID
	 * @return
	 * @throws LeagueDoesNotExistException
	 * @throws UserDoesNotExistException
	 */
	public int getNumberOfMatches(final String playerID, final String leagueID)
			throws LeagueDoesNotExistException, UserDoesNotExistException {
		return blms.getNumberOfMatches(playerID, leagueID);
	}

	/**
	 * EasyAccept facade for {@link BLMS#addMatchResult(Serializable, String, String, String)} method.
	 * 
	 * @param leagueId
	 * @param date
	 * @param winnerID
	 * @param loserID
	 * @return
	 * @throws ParseException
	 * @throws ValidationException 
	 * @throws UserDoesNotExistException 
	 * @throws LeagueDoesNotExistException 
	 */
	public Serializable addMatchResult(final String leagueId,
			final String date, final String winnerID, final String loserID)
			throws ParseException, LeagueDoesNotExistException, UserDoesNotExistException, ValidationException {

		return blms.addMatchResult(leagueId, date, winnerID, loserID);
	}

	/**
	 * EasyAccept facade for {@link BLMS#addMatchResult(Serializable, String, String, String, String, String, String, String)} method.
	 * 
	 * @param leagueId
	 * @param date
	 * @param winnerID
	 * @param loserID
	 * @param length
	 * @param score
	 * @param longestRunForWinner
	 * @param longestRunForLoser
	 * @return
	 * @throws NumberFormatException
	 * @throws ParseException
	 * @throws ValidationException 
	 * @throws UserDoesNotExistException 
	 * @throws LeagueDoesNotExistException 
	 * @throws RestrictionException 
	 */
	public Serializable addMatchResult(final String leagueId,
			final String date, final String winnerID, final String loserID,
			final String length, final String score,
			final String longestRunForWinner, final String longestRunForLoser)
			throws NumberFormatException, ParseException, RestrictionException, LeagueDoesNotExistException, UserDoesNotExistException, ValidationException {
		return blms.addMatchResult(leagueId, date, winnerID, loserID, length,
				score, longestRunForWinner, longestRunForLoser);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getNumberOfWins(String, Serializable)} method.
	 * 
	 * @param playerID
	 * @param leagueID
	 * @return
	 * @throws LeagueDoesNotExistException
	 * @throws UserDoesNotExistException
	 */
	public int getNumberOfWins(final String playerID, final String leagueID)
			throws LeagueDoesNotExistException, UserDoesNotExistException {
		return blms.getNumberOfWins(playerID, leagueID);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getNumberOfLosses(String, Serializable)} method.
	 * 
	 * @param playerID
	 * @param leagueID
	 * @return
	 * @throws LeagueDoesNotExistException
	 * @throws UserDoesNotExistException
	 */
	public int getNumberOfLosses(final String playerID, final String leagueID)
			throws LeagueDoesNotExistException, UserDoesNotExistException {
		return blms.getNumberOfLosses(playerID, leagueID);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getMatch(Serializable, int)} method.
	 * 
	 * @param leagueID
	 * @param index
	 * @return
	 * @throws LeagueDoesNotExistException
	 */
	public Match getMatch(final String leagueID, final int index)
			throws LeagueDoesNotExistException {
		return blms.getMatch(leagueID, index);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getMatch(String, Serializable, int)} method. 
	 * 
	 * @param playerID
	 * @param leagueID
	 * @param index
	 * @return
	 * @throws UserDoesNotExistException
	 * @throws LeagueDoesNotExistException
	 */
	public Match getMatch(final String playerID, final String leagueID,
			final int index) throws UserDoesNotExistException,
			LeagueDoesNotExistException {
		return blms.getMatch(playerID, leagueID, index);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getMatchAsString(String, Serializable, int)} method.
	 * 
	 * @param playerID
	 * @param leagueID
	 * @param index
	 * @return
	 * @throws UserDoesNotExistException
	 * @throws LeagueDoesNotExistException
	 */
	public Serializable getMatchAsString(final String playerID,
			final String leagueID, final int index)
			throws UserDoesNotExistException, LeagueDoesNotExistException {

		return blms.getMatchAsString(playerID, leagueID, index);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getMatchDate(Serializable)} method.
	 * 
	 * @param matchId
	 * @return
	 * @throws MatchDoesNotExistException
	 */
	public String getMatchDate(final String matchId)
			throws MatchDoesNotExistException {
		return blms.getMatchDate(matchId);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getMatchByDate(Serializable, String, String, int)} method.
	 * 
	 * @param leagueId
	 * @param startDate
	 * @param endDate
	 * @param index
	 * @return
	 * @throws LeagueDoesNotExistException
	 * @throws ParseException
	 */
	public Match getMatchByDate(final String leagueId, final String startDate,
			final String endDate, final int index)
			throws LeagueDoesNotExistException, ParseException {
		return blms.getMatchByDate(leagueId, startDate, endDate, index);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getMatchByDate(String, Serializable, String, String, int)} method.
	 * 
	 * @param playerId
	 * @param leagueId
	 * @param startDate
	 * @param endDate
	 * @param index
	 * @return
	 * @throws LeagueDoesNotExistException
	 * @throws UserDoesNotExistException
	 * @throws ParseException
	 */
	public Serializable getMatchByDate(final String playerId,
			final String leagueId, final String startDate,
			final String endDate, final int index)
			throws LeagueDoesNotExistException, UserDoesNotExistException,
			ParseException {

		return blms.getMatchByDate(playerId, leagueId, startDate, endDate,
				index);
	}

	/**
	 * Returns the winner of the match.
	 * 
	 * @param matchId
	 *            the id of the match.
	 * @return the winner of the match.
	 * @throws UnknownAttributeException 
	 * @throws MatchDoesNotExistException 
	 */
	public Object getMatchWinner(final String matchId) throws MatchDoesNotExistException, UnknownAttributeException{
		return blms.getMatchAttribute(matchId, "winner");
	}

	/**
	 * Returns the loser of the match.
	 * 
	 * @param matchId
	 *            the id of the match.
	 * @return the loser of the match.
	 * @throws UnknownAttributeException 
	 * @throws MatchDoesNotExistException 
	 */
	public Object getMatchLoser(final String matchId) throws MatchDoesNotExistException, UnknownAttributeException{
		return blms.getMatchAttribute(matchId, "loser");
	}

	/**
	 * Returns the length of the match.
	 * 
	 * @param matchId
	 *            the id of the match.
	 * @return the length of the match.
	 * @throws UnknownAttributeException 
	 * @throws MatchDoesNotExistException 
	 */
	public Object getMatchLength(final String matchId) throws MatchDoesNotExistException, UnknownAttributeException{
		return blms.getMatchNumericAttribute(matchId, "length");
	}

	/**
	 * Returns the score of the match.
	 * 
	 * @param matchId
	 *            the id of the match.
	 * @return the score of the match.
	 * @throws UnknownAttributeException 
	 * @throws MatchDoesNotExistException 
	 */
	public Object getMatchScore(final String matchId) throws MatchDoesNotExistException, UnknownAttributeException{
		return blms.getMatchNumericAttribute(matchId, "score");
	}

	/**
	 * Returns the match for the longest run for the winner of the match.
	 * 
	 * @param matchId
	 *            the id of the match.
	 * @return the match for the longest run for the winner of the match.
	 * @throws UnknownAttributeException 
	 * @throws MatchDoesNotExistException 
	 */
	public Object getMatchLongestRunForWinner(final String matchId) throws MatchDoesNotExistException, UnknownAttributeException{
		return blms.getMatchNumericAttribute(matchId, "longestRunForWinner");
	}

	/**
	 * Returns the match for the longest run for the loser of the match.
	 * 
	 * @param matchId
	 *            the id of the match.
	 * @return the match for the longest run for the loser of the match.
	 * @throws UnknownAttributeException 
	 * @throws MatchDoesNotExistException 
	 */
	public Object getMatchLongestRunForLoser(final String matchId) throws MatchDoesNotExistException, UnknownAttributeException{
		return blms.getMatchNumericAttribute(matchId, "longestRunForLoser");
	}

	/**
	 * EasyAccept facade for {@link BLMS#updateMatchResult(Serializable, String, String, String, String, String, String, String)} method.
	 * 
	 * @param matchId
	 * @param date
	 * @param winnerID
	 * @param loserID
	 * @param length
	 * @param score
	 * @param longestRunForWinner
	 * @param longestRunForLoser
	 * @throws MatchDoesNotExistException
	 * @throws UserDoesNotExistException
	 * @throws ValidationException
	 * @throws ParseException
	 * @throws RestrictionException 
	 */
	public void updateMatchResult(final String matchId, final String date,
			final String winnerID, final String loserID, final String length,
			final String score, final String longestRunForWinner,
			final String longestRunForLoser) throws MatchDoesNotExistException, UserDoesNotExistException, ValidationException, ParseException, RestrictionException{
		blms.updateMatchResult(matchId, date, winnerID, loserID, length, score,
				longestRunForWinner, longestRunForLoser);
	}

	/**
	 * EasyAccept facade for {@link MatchService#deleteMatch(Serializable)} method.
	 * 
	 * @param matchId
	 * @throws MatchDoesNotExistException
	 */
	public void deleteMatch(final String matchId) throws MatchDoesNotExistException{
		blms.getMatchService().deleteMatch(matchId);
	}

	/**
	 * EasyAccept facade for {@link BLMS#getPlayerStanding(String, Serializable)} method.
	 * 
	 * @param playerId
	 * @param leagueId
	 * @return
	 * @throws LeagueDoesNotExistException
	 * @throws UserDoesNotExistException
	 */
	public Object getPlayerStanding(final String playerId, final String leagueId) throws LeagueDoesNotExistException, UserDoesNotExistException{
		return blms.getPlayerStanding(playerId, leagueId);
	}

	/**
	 * EasyAccept facade for {@link BLMS#defineStandingsExpression(String, String)} method.
	 * 
	 * @param leagueId
	 * @param expression
	 * @throws LeagueDoesNotExistException
	 * @throws ParseException
	 */
	public void defineStandingsExpression(final String leagueId,
			final String expression) throws LeagueDoesNotExistException,
			ParseException {
		blms.defineStandingsExpression(leagueId, expression);
	}
	
	/**
	 * EasyAccept facade for {@link BLMS#defineHandicapExpression(String, String)} method.
	 * 
	 * @param leagueId
	 * @param expression
	 * @throws LeagueDoesNotExistException
	 * @throws ParseException
	 */
	public void defineHandicapExpression(final String leagueId,
			final String expression) throws LeagueDoesNotExistException,
			ParseException {
		blms.defineHandicapExpression(leagueId, expression);
	}
	
	/**
	 * EasyAccept facade for {@link BLMS#setPlayerHandicap(String, String, String, int)} method.
	 * 
	 * @param playerId
	 * @param leagueId
	 * @param handicap
	 * @param date
	 * @throws LeagueDoesNotExistException 
	 * @throws UserDoesNotExistException 
	 * @throws ParseException 
	 */
	public void setPlayerHandicap(final String playerId, final String leagueId, int handicap, String date) throws LeagueDoesNotExistException, UserDoesNotExistException, ParseException {
		blms.setPlayerHandicap(playerId, leagueId, date, handicap);
	}

	/**
	 * EasyAccept facade for {@link BLMS#setDateFormat(String)} method.
	 * 
	 * @param format
	 */
	public void dateFormat(final String format) {
		blms.setDateFormat(format);
	}

	/**
	 * EasyAccept facade for {@link BLMS#today()} method.
	 * 
	 * @return
	 */
	public String todaysDate() {
		return blms.today();
	}

	/**
	 * EasyAccept facade for {@link BLMS#todayDate()} method.
	 * 
	 * @return
	 */
	public Date blmsTodayDate() {
		return blms.todayDate();
	}
	
	/**
	 * Parse to String a collection of objects,
	 * 
	 * @param iterable
	 * @return
	 */
	private String toString(final Iterable<?> iterable) {
		final StringBuffer buffer = new StringBuffer();
		final Iterator<?> tokens = iterable.iterator();
		if (tokens.hasNext()) {
			buffer.append(tokens.next());
			while (tokens.hasNext()) {
				buffer.append(", ");
				buffer.append(tokens.next());
			}
		}
		return buffer.toString();
	}
	
	/**
	 * EasyAccept facade for {@link BLMS#matchup(String, String, String)} method.
	 * 
	 * @param handicapStronger
	 * @param handicapWeaker
	 * @param scoreHigherRatedPlayer
	 * @return
	 * @throws RestrictionException
	 * @throws UserDoesNotExistException
	 */
	public int matchup(String handicapStronger, String handicapWeaker, String scoreHigherRatedPlayer) throws RestrictionException, UserDoesNotExistException {
		return this.blms.matchup(handicapStronger,handicapWeaker,scoreHigherRatedPlayer);
	}
	
	/**
	 * EasyAccept facade for {@link BLMS#matchup(String, String, String, String)} method.
	 * 
	 * @param strongerMail
	 * @param weakerMail
	 * @param scoreHigherRatedPlayer
	 * @param leagueId
	 * @return
	 * @throws RestrictionException
	 * @throws UserDoesNotExistException
	 * @throws LeagueDoesNotExistException
	 */
	public int matchup(String strongerMail, String weakerMail, String scoreHigherRatedPlayer, String leagueId) throws RestrictionException, UserDoesNotExistException, LeagueDoesNotExistException {
		return this.blms.matchup(strongerMail,weakerMail,scoreHigherRatedPlayer, leagueId);
	}
	
	/**
	 * EasyAccept facade for {@link BLMS#getPlayerHandicap(Serializable, String)} method.
	 * 
	 * @param playerId
	 * @param leagueId
	 * @return
	 * @throws UserDoesNotExistException
	 * @throws LeagueDoesNotExistException
	 */
	public int getPlayerHandicap(String playerId, String leagueId) throws UserDoesNotExistException, LeagueDoesNotExistException {
		return this.blms.getPlayerHandicap(playerId, leagueId);
	}
	
	/**
	 * EasyAccept facade for {@link BLMS#getHandicapHistorySize(String, String)} method.
	 * 
	 * @param playerId
	 * @param leagueId
	 * @return
	 * @throws LeagueDoesNotExistException
	 * @throws UserDoesNotExistException
	 */
	public int getHandicapHistorySize(String playerId, String leagueId) throws LeagueDoesNotExistException, UserDoesNotExistException {
		return blms.getHandicapHistorySize(playerId, leagueId);
	}
	
	/**
	 * EasyAccept facade for {@link BLMS#getHandicapHistoryLastUpdate(String, String)} method.
	 * 
	 * @param playerId
	 * @param leagueId
	 * @return
	 * @throws UserDoesNotExistException 
	 * @throws LeagueDoesNotExistException 
	 */
	public String getHandicapHistoryLastUpdate(String  playerId, String leagueId) throws LeagueDoesNotExistException, UserDoesNotExistException {
		return blms.getHandicapHistoryLastUpdate(playerId, leagueId);
	}
}